<?php
	/**
	 * @package AmpleHarvest
	 */
	use\ampleharvest\code;

	/**
	 * @brief This file is used to Run all notifications that are due.
	 *
	 * - Revision History
	 *  - 0.1
	 * 	 - <b>Date</b>: 05 AUG 2011
	 * 	 - <b>Author</b>: Randy Blancett
	 * 	  - Initial Version
	 *
	 * @author Randy Blancett
	 * @version 0.1
	 * @ingroup code script classes
	 */
	require_once dirname(dirname(dirname(__FILE__))) . '/config/cConfig.php';
	require_once dirname(dirname(dirname(__FILE__))) . '/classes/cAmpleHarvestLog.php';
	require_once dirname(dirname(dirname(__FILE__))) . '/classes/search/solr/cSolr.php';

	$obj_Log = new \cAmpleHarvestLog();
	$obj_Solr = new cSolr(null, null, null);
	$this->output_Error("Using default solr instance -- clear_AllSolrDocuments");

	$obj_Log->do_Log(cAmpleHarvestLog::C_STR_ACTION_DATA_INDEX_INFO,
		"Started Clearing Solr",
		cAmpleHarvestLog::C_INT_LEVEL_INFO);

	try
	{
		$obj_Solr->deleteByQuery("*:*");
		$obj_Solr->commit();
		print("removed\n");
	}
	catch (Exception $e)
	{
		print("failed to remove\n");
		$obj_Log->do_Log(cAmpleHarvestLog::C_STR_ACTION_DATA_INDEX_ERROR,
			"Failed to remove All documents form the solr index\n " + $e,
			cAmpleHarvestLog::C_INT_LEVEL_ERRORS);
	}

	$obj_Solr->optimize();
	print("Finish\n");

	$obj_Log->do_Log(cAmpleHarvestLog::C_STR_ACTION_DATA_INDEX_INFO,
		"Finished Clearing all solr documents",
		cAmpleHarvestLog::C_INT_LEVEL_INFO);

?>
	